import pandas as pd
import os
import glob
import re
import matplotlib.pyplot as plt
#!pip install cufflink
#!pip install plotly
import numpy as np
import seaborn as sns
#import cufflinks as cf
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from plotly.offline import init_notebook_mode, download_plotlyjs,plot,iplot
import plotly.express as px
%matplotlib inline
#cf.go_offline()
init_notebook_mode(connected=True)
pl16 = pd.read_csv('pl_15-16.csv')
#pl17 = pd.read_csv('pl_16-17.csv')
#pl18 = pd.read_csv('pl_17-18.csv')
#pl19 = pd.read_csv('pl_18-19.csv')
#pl20 = pd.read_csv('pl_19-20.csv')
pl16.drop("Unnamed: 0", axis=1, inplace=True)
pl16.describe().iloc[:,30:]
| Goals with right foot | Goals with left foot | Hit woodwork | Goals per match | Penalties scored | Freekicks scored | Shots | Shots on target | Big chances missed | Saves | Penalties saved | Punches | High Claims | Catches | Sweeper clearances | Throw outs | Goal Kicks | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| count | 681.000000 | 681.000000 | 681.000000 | 435.000000 | 435.000000 | 435.000000 | 435.000000 | 435.000000 | 435.000000 | 76.000000 | 76.000000 | 76.000000 | 76.000000 | 76.000000 | 76.000000 | 76.000000 | 76.000000 |
| mean | 0.757709 | 0.358297 | 0.328928 | 0.072115 | 0.156322 | 0.048276 | 18.000000 | 6.137931 | 1.427586 | 28.618421 | 0.144737 | 6.000000 | 13.000000 | 3.526316 | 7.355263 | 40.144737 | 82.842105 |
| std | 2.020855 | 1.080969 | 0.864598 | 0.121436 | 0.650009 | 0.253938 | 25.590087 | 9.899230 | 2.902593 | 36.768453 | 0.508696 | 10.919096 | 18.285149 | 5.095027 | 11.260200 | 57.951406 | 108.159765 |
| min | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| 25% | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| 50% | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 7.000000 | 1.000000 | 0.000000 | 7.000000 | 0.000000 | 0.000000 | 1.500000 | 0.000000 | 1.500000 | 7.000000 | 19.500000 |
| 75% | 0.000000 | 0.000000 | 0.000000 | 0.110000 | 0.000000 | 0.000000 | 28.500000 | 9.000000 | 1.000000 | 60.500000 | 0.000000 | 8.250000 | 22.250000 | 6.250000 | 10.500000 | 60.500000 | 156.000000 |
| max | 19.000000 | 13.000000 | 7.000000 | 0.800000 | 6.000000 | 2.000000 | 158.000000 | 75.000000 | 22.000000 | 121.000000 | 3.000000 | 66.000000 | 81.000000 | 18.000000 | 46.000000 | 204.000000 | 378.000000 |
#pl01 = pd.read_csv('pl_2000-2001.csv')
pl_full_data = pd.read_csv("English_Premier_League_data_2009-2019.csv")
pl_data = pl_full_data.copy()
pl_full_data
| Div | Date | HomeTeam | AwayTeam | FTHG | FTAG | FTR | HTHG | HTAG | HTR | ... | HST | AST | HF | AF | HC | AC | HY | AY | HR | AR | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | E0 | 2009-08-15 00:00:00 | Aston Villa | Wigan | 0 | 2 | A | 0 | 1 | A | ... | 5 | 7 | 15 | 14 | 4 | 6 | 2 | 2 | 0 | 0 |
| 1 | E0 | 2009-08-15 00:00:00 | Blackburn | Man City | 0 | 2 | A | 0 | 1 | A | ... | 9 | 5 | 12 | 9 | 5 | 4 | 2 | 1 | 0 | 0 |
| 2 | E0 | 2009-08-15 00:00:00 | Bolton | Sunderland | 0 | 1 | A | 0 | 1 | A | ... | 3 | 13 | 16 | 10 | 4 | 7 | 2 | 1 | 0 | 0 |
| 3 | E0 | 2009-08-15 00:00:00 | Chelsea | Hull | 2 | 1 | H | 1 | 1 | D | ... | 12 | 3 | 13 | 15 | 12 | 4 | 1 | 2 | 0 | 0 |
| 4 | E0 | 2009-08-15 00:00:00 | Everton | Arsenal | 1 | 6 | A | 0 | 3 | A | ... | 5 | 9 | 11 | 13 | 4 | 9 | 0 | 0 | 0 | 0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 3795 | E0 | 2019-05-12 00:00:00 | Liverpool | Wolves | 2 | 0 | H | 1 | 0 | H | ... | 5 | 2 | 3 | 11 | 4 | 1 | 0 | 2 | 0 | 0 |
| 3796 | E0 | 2019-05-12 00:00:00 | Man United | Cardiff | 0 | 2 | A | 0 | 1 | A | ... | 10 | 4 | 9 | 6 | 11 | 2 | 3 | 3 | 0 | 0 |
| 3797 | E0 | 2019-05-12 00:00:00 | Southampton | Huddersfield | 1 | 1 | D | 1 | 0 | H | ... | 3 | 3 | 8 | 6 | 4 | 3 | 0 | 1 | 0 | 0 |
| 3798 | E0 | 2019-05-12 00:00:00 | Tottenham | Everton | 2 | 2 | D | 1 | 0 | H | ... | 3 | 9 | 10 | 13 | 7 | 4 | 0 | 2 | 0 | 0 |
| 3799 | E0 | 2019-05-12 00:00:00 | Watford | West Ham | 1 | 4 | A | 0 | 2 | A | ... | 8 | 9 | 10 | 10 | 7 | 2 | 1 | 0 | 1 | 0 |
3800 rows × 23 columns
pl_full_data.columns
Index(['Div', 'Date', 'HomeTeam', 'AwayTeam', 'FTHG', 'FTAG', 'FTR', 'HTHG',
'HTAG', 'HTR', 'Referee', 'HS', 'AS', 'HST', 'AST', 'HF', 'AF', 'HC',
'AC', 'HY', 'AY', 'HR', 'AR'],
dtype='object')
#dropping first column 'Div' as value is always E0
pl_data = pl_data.drop(['Div'], axis=1)
pl_data.columns=['Date','HomeTeam','AwayTeam','FT_Home_Goal','FT_Away_Goal','FT_Result','HT_Home_Goal','HT_Away_Goal',
'HT_Result','Referee','H_Shots','A_Shots','H_Shots_Target','A_Shots_Target','H_Foul',
'A_Foul','H_Corner','A_Corner','H_Yellow','A_Yellow','H_Red','A_Red']
pl_data.head()
| Date | HomeTeam | AwayTeam | FT_Home_Goal | FT_Away_Goal | FT_Result | HT_Home_Goal | HT_Away_Goal | HT_Result | Referee | ... | H_Shots_Target | A_Shots_Target | H_Foul | A_Foul | H_Corner | A_Corner | H_Yellow | A_Yellow | H_Red | A_Red | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2009-08-15 00:00:00 | Aston Villa | Wigan | 0 | 2 | A | 0 | 1 | A | M Clattenburg | ... | 5 | 7 | 15 | 14 | 4 | 6 | 2 | 2 | 0 | 0 |
| 1 | 2009-08-15 00:00:00 | Blackburn | Man City | 0 | 2 | A | 0 | 1 | A | M Dean | ... | 9 | 5 | 12 | 9 | 5 | 4 | 2 | 1 | 0 | 0 |
| 2 | 2009-08-15 00:00:00 | Bolton | Sunderland | 0 | 1 | A | 0 | 1 | A | A Marriner | ... | 3 | 13 | 16 | 10 | 4 | 7 | 2 | 1 | 0 | 0 |
| 3 | 2009-08-15 00:00:00 | Chelsea | Hull | 2 | 1 | H | 1 | 1 | D | A Wiley | ... | 12 | 3 | 13 | 15 | 12 | 4 | 1 | 2 | 0 | 0 |
| 4 | 2009-08-15 00:00:00 | Everton | Arsenal | 1 | 6 | A | 0 | 3 | A | M Halsey | ... | 5 | 9 | 11 | 13 | 4 | 9 | 0 | 0 | 0 | 0 |
5 rows × 22 columns
labels = ['Home Team Wins','Away Team Wins','Draw']
ft_results = pd.DataFrame(pl_data['FT_Result'].value_counts())
ft_results.head()
| FT_Result | |
|---|---|
| H | 1758 |
| A | 1102 |
| D | 940 |
values = ft_results["FT_Result"].values
values
array([1758, 1102, 940], dtype=int64)
# Pie chart
colors = ['#99ff99','#ff9999','#ffcc99']
sizes = [30, 45, 10]
# only "explode" the 2nd slice (i.e. 'Hogs')
explode = (0.1, 0, 0)
fig1, ax1 = plt.subplots()
ax1.pie(values, explode=explode, labels=labels, autopct='%2.1f%%',colors= colors,
shadow=True, startangle=90,textprops={'fontsize': 16})
# Equal aspect ratio ensures that pie is drawn as a circle
ax1.axis('equal')
plt.tight_layout()
plt.show()
import sys
!{sys.executable} -m pip install bar_chart_race
Requirement already satisfied: bar_chart_race in c:\users\nikhi\anaconda3\lib\site-packages (0.1.0) Requirement already satisfied: matplotlib>=3.1 in c:\users\nikhi\anaconda3\lib\site-packages (from bar_chart_race) (3.4.2) Requirement already satisfied: pandas>=0.24 in c:\users\nikhi\anaconda3\lib\site-packages (from bar_chart_race) (1.3.2) Requirement already satisfied: numpy>=1.16 in c:\users\nikhi\anaconda3\lib\site-packages (from matplotlib>=3.1->bar_chart_race) (1.20.3) Requirement already satisfied: cycler>=0.10 in c:\users\nikhi\anaconda3\lib\site-packages (from matplotlib>=3.1->bar_chart_race) (0.10.0) Requirement already satisfied: python-dateutil>=2.7 in c:\users\nikhi\anaconda3\lib\site-packages (from matplotlib>=3.1->bar_chart_race) (2.8.2) Requirement already satisfied: pillow>=6.2.0 in c:\users\nikhi\anaconda3\lib\site-packages (from matplotlib>=3.1->bar_chart_race) (8.3.1) Requirement already satisfied: pyparsing>=2.2.1 in c:\users\nikhi\anaconda3\lib\site-packages (from matplotlib>=3.1->bar_chart_race) (2.4.7) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\nikhi\anaconda3\lib\site-packages (from matplotlib>=3.1->bar_chart_race) (1.3.1) Requirement already satisfied: six in c:\users\nikhi\anaconda3\lib\site-packages (from cycler>=0.10->matplotlib>=3.1->bar_chart_race) (1.16.0) Requirement already satisfied: pytz>=2017.3 in c:\users\nikhi\anaconda3\lib\site-packages (from pandas>=0.24->bar_chart_race) (2021.1)
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
import bar_chart_race as bcr
from IPython.display import HTML
import warnings
warnings.filterwarnings("ignore")
from IPython.display import Video
pgfgg = pd.read_csv('all_season/Premier League 00_01.csv')
pgfgg.head()
| Position | Club | Played | Won | Drawn | Lost | GF | GA | GD | Points | season | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | Manchester United | 38 | 24 | 8 | 6 | 79 | 31 | 48 | 80 | 2000/2001 |
| 1 | 2 | Arsenal | 38 | 20 | 10 | 8 | 63 | 38 | 25 | 70 | 2000/2001 |
| 2 | 3 | Liverpool | 38 | 20 | 9 | 9 | 71 | 39 | 32 | 69 | 2000/2001 |
| 3 | 4 | Leeds United | 38 | 20 | 8 | 10 | 64 | 43 | 21 | 68 | 2000/2001 |
| 4 | 5 | Ipswich Town | 38 | 20 | 6 | 12 | 57 | 42 | 15 | 66 | 2000/2001 |
dir_loc='all_season/'
year=[]
loc=[]
for file in os.listdir(dir_loc):
print(file)
if file[-6]=='9':
year+=[1900+int(file[-6:-4])]
loc+=[os.path.join(dir_loc,file)]
else:
year+=[2000+int(file[-6:-4])]
loc+=[os.path.join(dir_loc,file)]
Premier League 00_01.csv Premier League 01_02.csv Premier League 02_03.csv Premier League 03_04.csv Premier League 04_05.csv Premier League 05_06.csv Premier League 06_07.csv Premier League 07_08.csv Premier League 08_09.csv Premier League 09_10.csv Premier League 10_11.csv Premier League 11_12.csv Premier League 12_13.csv Premier League 13_14.csv Premier League 14_15.csv Premier League 15_16.csv Premier League 16_17.csv Premier League 17_18.csv Premier League 18_19.csv Premier League 19_20.csv Premier League 92_93.csv Premier League 93_94.csv Premier League 94_95.csv Premier League 95_96.csv Premier League 96_97.csv Premier League 97_98.csv Premier League 98_99.csv Premier League 99_00.csv
df_season = pd.DataFrame(loc,year)
df_season = df_season.sort_index()
df_season.reset_index(inplace=True)
df_season.rename(columns = {0:'loc','index':'year'}, inplace = True)
df_season
| year | loc | |
|---|---|---|
| 0 | 1993 | all_season/Premier League 92_93.csv |
| 1 | 1994 | all_season/Premier League 93_94.csv |
| 2 | 1995 | all_season/Premier League 94_95.csv |
| 3 | 1996 | all_season/Premier League 95_96.csv |
| 4 | 1997 | all_season/Premier League 96_97.csv |
| 5 | 1998 | all_season/Premier League 97_98.csv |
| 6 | 1999 | all_season/Premier League 98_99.csv |
| 7 | 2000 | all_season/Premier League 99_00.csv |
| 8 | 2001 | all_season/Premier League 00_01.csv |
| 9 | 2002 | all_season/Premier League 01_02.csv |
| 10 | 2003 | all_season/Premier League 02_03.csv |
| 11 | 2004 | all_season/Premier League 03_04.csv |
| 12 | 2005 | all_season/Premier League 04_05.csv |
| 13 | 2006 | all_season/Premier League 05_06.csv |
| 14 | 2007 | all_season/Premier League 06_07.csv |
| 15 | 2008 | all_season/Premier League 07_08.csv |
| 16 | 2009 | all_season/Premier League 08_09.csv |
| 17 | 2010 | all_season/Premier League 09_10.csv |
| 18 | 2011 | all_season/Premier League 10_11.csv |
| 19 | 2012 | all_season/Premier League 11_12.csv |
| 20 | 2013 | all_season/Premier League 12_13.csv |
| 21 | 2014 | all_season/Premier League 13_14.csv |
| 22 | 2015 | all_season/Premier League 14_15.csv |
| 23 | 2016 | all_season/Premier League 15_16.csv |
| 24 | 2017 | all_season/Premier League 16_17.csv |
| 25 | 2018 | all_season/Premier League 17_18.csv |
| 26 | 2019 | all_season/Premier League 18_19.csv |
| 27 | 2020 | all_season/Premier League 19_20.csv |
data=pd.read_csv(df_season.loc[0,'loc'])
data.columns
Index(['Position', 'Club', 'Played', 'Won', 'Drawn', 'Lost', 'GF', 'GA', 'GD',
'Points', 'season'],
dtype='object')
final_data=data[['Position','Club','season','Points']]
final_data.loc[:,'year']=1993
for j in range(1,len(df_season)):
if j==14:
df_add =pd.read_csv(df_season.loc[j,'loc'])
df_add.rename(columns={'PointsForm':'Points',}, inplace=True)
df_add.loc[:,'year']=(1993+j)
conc=df_add[['Position','Club','season','Points','year']]
final_data=pd.concat([final_data,conc])
elif j!=14:
df_add =pd.read_csv(df_season.loc[j,'loc'])
df_add.loc[:,'year']=(1993+j)
conc=df_add[['Position','Club','season','Points','year']]
final_data=pd.concat([final_data,conc])
final_data
| Position | Club | season | Points | year | |
|---|---|---|---|---|---|
| 0 | 1 | Manchester United | 1992/1993 | 84.0 | 1993 |
| 1 | 2 | Aston Villa | 1992/1993 | 74.0 | 1993 |
| 2 | 3 | Norwich City | 1992/1993 | 72.0 | 1993 |
| 3 | 4 | Blackburn Rovers | 1992/1993 | 71.0 | 1993 |
| 4 | 5 | Queens Park Rangers | 1992/1993 | 63.0 | 1993 |
| ... | ... | ... | ... | ... | ... |
| 15 | 16 | West Ham United | 2019/2020 | 27.0 | 2020 |
| 16 | 17 | Watford | 2019/2020 | 27.0 | 2020 |
| 17 | 18 | Bournemouth | 2019/2020 | 27.0 | 2020 |
| 18 | 19 | Aston Villa | 2019/2020 | 25.0 | 2020 |
| 19 | 20 | Norwich City | 2019/2020 | 21.0 | 2020 |
566 rows × 5 columns
final_data.describe()
| Position | Points | year | |
|---|---|---|---|
| count | 566.000000 | 566.000000 | 566.000000 |
| mean | 10.616608 | 52.210247 | 2006.367491 |
| std | 5.850619 | 16.272567 | 8.143792 |
| min | 1.000000 | 11.000000 | 1993.000000 |
| 25% | 6.000000 | 41.000000 | 1999.000000 |
| 50% | 11.000000 | 49.000000 | 2006.000000 |
| 75% | 16.000000 | 62.750000 | 2013.000000 |
| max | 22.000000 | 100.000000 | 2020.000000 |
final_stats_data=data[["Club","Played","Won","Drawn","Lost","GF","GA","GD","Points","season"]]
final_stats_data.loc[:,'year']=1993
for j in range(1,len(df_season)):
if j==14:
df_add =pd.read_csv(df_season.loc[j,'loc'])
df_add.rename(columns={'PointsForm':'Points',}, inplace=True)
df_add.rename(columns={'\tPlayed':'Played'}, inplace=True)
df_add.loc[:,'year']=(1993+j)
conc=df_add[["Club","Played","Won","Drawn","Lost","GF","GA","GD","Points","season","year"]]
final_stats_data=pd.concat([final_stats_data,conc])
elif j!=14:
df_add =pd.read_csv(df_season.loc[j,'loc'])
df_add.loc[:,'year']=(1993+j)
df_add.rename(columns={'\tPlayed':'Played'}, inplace=True)
conc=df_add[["Club","Played","Won","Drawn","Lost","GF","GA","GD","Points","season","year"]]
final_stats_data=pd.concat([final_stats_data,conc])
final_stats_data
| Club | Played | Won | Drawn | Lost | GF | GA | GD | Points | season | year | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Manchester United | 42 | 24 | 12 | 6 | 67 | 31 | 36 | 84.0 | 1992/1993 | 1993 |
| 1 | Aston Villa | 42 | 21 | 11 | 10 | 57 | 40 | 17 | 74.0 | 1992/1993 | 1993 |
| 2 | Norwich City | 42 | 21 | 9 | 12 | 61 | 65 | -4 | 72.0 | 1992/1993 | 1993 |
| 3 | Blackburn Rovers | 42 | 20 | 11 | 11 | 68 | 46 | 22 | 71.0 | 1992/1993 | 1993 |
| 4 | Queens Park Rangers | 42 | 17 | 12 | 13 | 63 | 55 | 8 | 63.0 | 1992/1993 | 1993 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 15 | West Ham United | 29 | 7 | 6 | 16 | 35 | 50 | -15 | 27.0 | 2019/2020 | 2020 |
| 16 | Watford | 29 | 6 | 9 | 14 | 27 | 44 | -17 | 27.0 | 2019/2020 | 2020 |
| 17 | Bournemouth | 29 | 7 | 6 | 16 | 29 | 47 | -18 | 27.0 | 2019/2020 | 2020 |
| 18 | Aston Villa | 28 | 7 | 4 | 17 | 34 | 56 | -22 | 25.0 | 2019/2020 | 2020 |
| 19 | Norwich City | 29 | 5 | 6 | 18 | 25 | 52 | -27 | 21.0 | 2019/2020 | 2020 |
566 rows × 11 columns
file_name = 'prem_scoreboard.xlsx'
# saving the excel
final_stats_data.to_excel(file_name)
final1 = final_data.copy()
final2 = final1.set_index(['season','Club'])
final3 = final1.set_index(['season','Club']).unstack()['Points']
final3.fillna(0,inplace = True)
final3
| Club | Arsenal | Aston Villa | Barnsley | Birmingham City | Blackburn Rovers | Blackpool | Bolton Wanderers | Bournemouth | Bradford City | Brighton and Hove Albion | ... | Swansea City | Swindon Town | Tottenham Hotspur | Watford | West Bromwich Albion | West Ham United | WestHam United | Wigan Athletic | Wimbledon | Wolverhampton Wanderers |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| season | |||||||||||||||||||||
| 1992/1993 | 56.0 | 74.0 | 0.0 | 0.0 | 71.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 59.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 54.0 | 0.0 |
| 1993/1994 | 71.0 | 57.0 | 0.0 | 0.0 | 84.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 30.0 | 45.0 | 0.0 | 0.0 | 52.0 | 0.0 | 0.0 | 65.0 | 0.0 |
| 1994/1995 | 51.0 | 48.0 | 0.0 | 0.0 | 89.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 62.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 56.0 | 0.0 |
| 1995/1996 | 63.0 | 63.0 | 0.0 | 0.0 | 61.0 | 0.0 | 29.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 61.0 | 0.0 | 0.0 | 51.0 | 0.0 | 0.0 | 41.0 | 0.0 |
| 1996/1997 | 68.0 | 61.0 | 0.0 | 0.0 | 42.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 46.0 | 0.0 | 0.0 | 42.0 | 0.0 | 0.0 | 56.0 | 0.0 |
| 1997/1998 | 78.0 | 57.0 | 35.0 | 0.0 | 58.0 | 0.0 | 40.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 44.0 | 0.0 | 0.0 | 56.0 | 0.0 | 0.0 | 44.0 | 0.0 |
| 1998/1999 | 78.0 | 55.0 | 0.0 | 0.0 | 35.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 47.0 | 0.0 | 0.0 | 57.0 | 0.0 | 0.0 | 42.0 | 0.0 |
| 1999/2000 | 73.0 | 58.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 36.0 | 0.0 | ... | 0.0 | 0.0 | 53.0 | 24.0 | 0.0 | 55.0 | 0.0 | 0.0 | 33.0 | 0.0 |
| 2000/2001 | 70.0 | 54.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 26.0 | 0.0 | ... | 0.0 | 0.0 | 49.0 | 0.0 | 0.0 | 0.0 | 42.0 | 0.0 | 0.0 | 0.0 |
| 2001/2002 | 87.0 | 50.0 | 0.0 | 0.0 | 46.0 | 0.0 | 40.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 53.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2002/2003 | 78.0 | 45.0 | 0.0 | 48.0 | 60.0 | 0.0 | 44.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 50.0 | 0.0 | 26.0 | 42.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2003/2004 | 90.0 | 56.0 | 0.0 | 50.0 | 44.0 | 0.0 | 53.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 45.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 33.0 |
| 2004/2005 | 83.0 | 47.0 | 0.0 | 45.0 | 42.0 | 0.0 | 58.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 52.0 | 0.0 | 34.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2005/2006 | 67.0 | 42.0 | 0.0 | 34.0 | 63.0 | 0.0 | 56.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 65.0 | 0.0 | 30.0 | 55.0 | 0.0 | 51.0 | 0.0 | 0.0 |
| 2006/2007 | 68.0 | 50.0 | 0.0 | 0.0 | 52.0 | 0.0 | 56.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 60.0 | 28.0 | 0.0 | 41.0 | 0.0 | 38.0 | 0.0 | 0.0 |
| 2007/2008 | 83.0 | 60.0 | 0.0 | 35.0 | 58.0 | 0.0 | 37.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 46.0 | 0.0 | 0.0 | 49.0 | 0.0 | 40.0 | 0.0 | 0.0 |
| 2008/2009 | 72.0 | 62.0 | 0.0 | 0.0 | 41.0 | 0.0 | 41.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 51.0 | 0.0 | 32.0 | 51.0 | 0.0 | 45.0 | 0.0 | 0.0 |
| 2009/2010 | 75.0 | 64.0 | 0.0 | 50.0 | 50.0 | 0.0 | 39.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 70.0 | 0.0 | 0.0 | 35.0 | 0.0 | 36.0 | 0.0 | 38.0 |
| 2010/2011 | 68.0 | 48.0 | 0.0 | 39.0 | 43.0 | 39.0 | 46.0 | 0.0 | 0.0 | 0.0 | ... | 0.0 | 0.0 | 62.0 | 0.0 | 47.0 | 33.0 | 0.0 | 42.0 | 0.0 | 40.0 |
| 2011/2012 | 70.0 | 38.0 | 0.0 | 0.0 | 31.0 | 0.0 | 36.0 | 0.0 | 0.0 | 0.0 | ... | 47.0 | 0.0 | 69.0 | 0.0 | 47.0 | 0.0 | 0.0 | 43.0 | 0.0 | 25.0 |
| 2012/2013 | 73.0 | 41.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | ... | 46.0 | 0.0 | 72.0 | 0.0 | 49.0 | 46.0 | 0.0 | 36.0 | 0.0 | 0.0 |
| 2013/2014 | 79.0 | 38.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | ... | 42.0 | 0.0 | 69.0 | 0.0 | 36.0 | 40.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2014/2015 | 75.0 | 38.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | ... | 56.0 | 0.0 | 64.0 | 0.0 | 44.0 | 47.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2015/2016 | 71.0 | 17.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 42.0 | 0.0 | 0.0 | ... | 47.0 | 0.0 | 70.0 | 45.0 | 43.0 | 62.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2016/2017 | 75.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 46.0 | 0.0 | 0.0 | ... | 41.0 | 0.0 | 86.0 | 40.0 | 45.0 | 45.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2017/2018 | 63.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 44.0 | 0.0 | 40.0 | ... | 33.0 | 0.0 | 77.0 | 41.0 | 31.0 | 42.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| 2018/2019 | 70.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 45.0 | 0.0 | 36.0 | ... | 0.0 | 0.0 | 71.0 | 50.0 | 0.0 | 52.0 | 0.0 | 0.0 | 0.0 | 57.0 |
| 2019/2020 | 40.0 | 25.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 27.0 | 0.0 | 29.0 | ... | 0.0 | 0.0 | 41.0 | 27.0 | 0.0 | 27.0 | 0.0 | 0.0 | 0.0 | 43.0 |
28 rows × 50 columns
final4 = final3
bcr.bar_chart_race(
df=final4,
filename='PL_BarChartRace.mp4',
orientation='h',
sort='desc',
n_bars=20,
fixed_order=False,
fixed_max=False,
steps_per_period=50,
interpolate_period=False,
label_bars=True,
bar_size=.95,
period_label={'x': .99, 'y': .25, 'ha': 'right', 'va': 'center'},
#period_fmt='%B %d, %Y',
period_summary_func=lambda v, r: {'x': .99, 'y': .18,'s': '',
'ha': 'right', 'size': 8, 'family': 'Courier New'},
#perpendicular_bar_func='median',
period_length=1500,
figsize=(8,4),
dpi=500,
cmap='dark24',
title='Premier League Standings 1992-2020',
title_size=15,
bar_label_size=7,
tick_label_size=5,
shared_fontdict={'color' : '.1'},
scale='linear',
writer=None,
fig=None,
bar_kwargs={'alpha': .7},
filter_column_colors=True)
Video("PL_BarChartRace.mp4", width=1000, height=800, embed=True)